package com.greydawn.MementoPattern;

/**
 * @Author: zhongwr
 * @Create: 2021/12/19 14:55
 * @Version 1.0
 * @Description: 显式使用状态
 */
public class Originator {

    private int lifeValue;

    public int getLifeValue() {
        return lifeValue;
    }

    public void setLifeValue(int lifeValue) {
        this.lifeValue = lifeValue;
    }

    public void recoverState(Memento memento) {
        this.lifeValue = memento.getLifeValue();
    }

    public Memento saveState() {
        return new Memento(lifeValue);
    }

}
